//
//  ViewController.m
//  TestLabelTextColor
//
//  Created by 郑东喜 on 2016/10/31.
//  Copyright © 2016年 郑东喜. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *text;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
    NSMutableAttributedString *content = [[NSMutableAttributedString alloc] initWithString:@"This is a under line label"];
    NSRange contentRange = {0, [content length]};
    [label setTextColor:[UIColor redColor]];
    [content addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:contentRange];
    
    label.attributedText = content;
    
    [self.view addSubview:label];
    
    self.text = label;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
